#define _CRT_SECURE_NO_WARNINGS 1

void merge(int* nums1, int nums1Size, int m, int* nums2, int nums2Size, int n) {
    int s1 = m - 1, s2 = n - 1;
    int dst = m + n - 1;
    while (s1 >= 0 && s2 >= 0)
    {
        if (nums1[s1] > nums2[s2])
            nums1[dst--] = nums1[s1--];
        else
            nums1[dst--] = nums2[s2--];
    }
    while (s2 >= 0)
    {
        nums1[dst--] = nums2[s2--];
    }
}

int removeDuplicates(int* nums, int numsSize) {
    int slow = 0, fast = 0;
    while (fast < numsSize)
    {
        if (nums[slow] == nums[fast])
        {
            fast++;
        }
        else
            nums[++slow] = nums[fast++];
    }
    return slow + 1;
}